﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AdvertiseAdd.aspx.cs" Inherits="admin_AdvertiseAdd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function check() {
            document.getElementById("txtMsg").value = document.getElementById("flImgSwf").value;
        }
        $(document).ready(function () {
            $('#btnAdd').click(function () {
                var filename = $('#flImgSwf');
                if (filename.val() != "") {
                    var dotArray = filename.val().split(".");
                    if (dotArray.length < 2) {
                        alert("您上传的不是图片文件，请重新上传！");
                        return false;
                    }
                    else {
                        var FileExt;
                        FileExt = dotArray[dotArray.length - 1];
                        if (FileExt == "jpg" || FileExt == "jpeg" || FileExt == "gif" || FileExt == "png" || FileExt == "swf") {
                            return true;
                        }
                        else {
                            alert("您上传的不是图片文件或flash文件，请重新上传！");
                            return false;
                        }
                    }
                }
            })
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="query_form_table">
            <tr>
                <th>
                    广告ID名
                </th>
                <td>
                    <asp:TextBox ID="txtId" runat="server" Width="300"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtId"
                        ErrorMessage="必填项"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <th>
                    广告链接
                </th>
                <td>
                    <asp:TextBox ID="txtLink" runat="server" Width="300"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtLink"
                        ErrorMessage="必填项"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtLink"
                        ErrorMessage="请输入正确链接格式" ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <th>
                    广告图片或flash
                </th>
                <td>
                    <input id="txtMsg" readonly="readonly" style="width: 237px" />
                    <asp:FileUpload ID="flImgSwf" runat="server" onchange="check()" /><br />
                    <asp:TextBox ID="lblPic" runat="server" TextMode="MultiLine" Height="118px" 
                        Width="402px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btnAdd" CssClass="common_button" runat="server" Text="添加" OnClick="btnAdd_Click" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
